package com.yanghui.agent.agent.springboot.a.controller;

import com.yanghui.agent.agent.springboot.a.entity.User;
import com.yanghui.agent.agent.springboot.a.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {

    @Autowired
    private IUserService userService;

    @RequestMapping("/login")
    public String login(String name,String password){
        log.info("name={},password={}",name,password);
        return this.userService.login(name,password);
    }

    @RequestMapping(value = "/queryById")
    public User queryById(Long id){
        log.info("id={}",id);
        return this.userService.queryById(id);
    }

    @RequestMapping(value = "/testInsert")
    public String testInsert(){
        this.userService.testInsert();
        return "UP";
    }

    @RequestMapping(value = "/testSelect")
    public String testSelect(){
        return this.userService.testSelect();
    }
}
